//
//  ReadMyListViewController.m
//  WYnewsss
//
//  Created by lanou on 16/4/22.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ReadMyListViewController.h"
#import "ReadMyListModel.h"
#import "ReadAddViewController.h"
#import "BaseTableViewCell.h"
#import "FactoryTableViewCell.h"
#import "ReadMyListViewCell.h"
#import "ReadAddModel.h"
#import "ReadMyDetailViewController.h"
#import "FMDB.h"
#import "ReadAddDB.h"
#import "UserInfoManager.h"
@interface ReadMyListViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UITableView *myListTableView;
@property(nonatomic,strong)NSMutableArray *myListArray;
@property (weak, nonatomic) IBOutlet UIView *gesView;

@end

@implementation ReadMyListViewController
-(NSMutableArray *)myListArray{
    if (!_myListArray) {
        self.myListArray=[NSMutableArray array];
    }
    return _myListArray;
}
// subscribe
- (void)viewDidLoad {
    [super viewDidLoad];
    _gesView.userInteractionEnabled =YES;
    UITapGestureRecognizer *ges =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(event:)];
    [_gesView addGestureRecognizer:ges];
    [ges setNumberOfTapsRequired:1];
    
  
    
    
    
      
    
    // Do any additional setup after loading the view from its nib.
}
//-(void)findDB{
//    ReadAddDB *db =[[ReadAddDB alloc]init];
//    self.myListArray =[db findWithUserID:[UserInfoManager getUserID]];
//    [_myListTableView reloadData];
//}


-(void)event:(UITapGestureRecognizer *)gesture{
    
    ReadAddViewController *addVC =[[ReadAddViewController alloc]init];
    
    [self.navigationController pushViewController:addVC animated:YES];
    //[self presentViewController:addVC animated:YES completion:nil];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _myListArray.count;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ReadAddModel *model= _myListArray[indexPath.row];
    
    BaseTableViewCell *cell =[FactoryTableViewCell creatTableViewCell:model withTableView:tableView andIndexPath:indexPath];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    
    [cell setDataWithModel:_addModel];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
